<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
<meta charset="utf-8">
<title>广告管理后台</title>
<meta name="viewport" content="width=device-width">
<!-- Bootstrap CSS Toolkit styles -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Generic page styles -->
<link rel="stylesheet" href="css/style.css">
<!-- Bootstrap styles for responsive website layout, supporting different screen sizes -->
<link rel="stylesheet" href="css/bootstrap-responsive.min.css">
<!-- Bootstrap CSS fixes for IE6 -->
<!--[if lt IE 7]><link rel="stylesheet" href="http://blueimp.github.com/cdn/css/bootstrap-ie6.min.css"><![endif]-->
<!-- Bootstrap Image Gallery styles -->
<link rel="stylesheet" href="css/bootstrap-image-gallery.min.css">
<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
<link rel="stylesheet" href="css/jquery.fileupload-ui.css">
<!-- Shim to make HTML5 elements usable in older Internet Explorer versions -->
<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>

<?php
// 登录调用文件，读取shadow中存放的密码
session_start();

$fp = file("shadow");
$db_password = trim($fp[0]);

//echo "shuju".$db_password;

$logon_hint = "请在此登录";
if(isset($_POST['password']))
{
    $logon_password = trim(md5($_POST['password']));
    if($logon_password == $db_password)
    {
        $_SESSION['username'] = "admin";
        header("location:index.php");
    }else{
        $logon_hint = "密码错误，请重试";
    }
}

// 一旦$_SESSION['username']有了值，这个表格就不会再有机会被输出了


?>

<div class="well">
<center>
<h3 align="center">广告管理登录</h3>
<form class="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<font color="red"><span><?php echo $logon_hint; ?></span></font><br><br>
管理密码  <input type="password" name="password">
<input type="submit" value="登录" class="btn"></input>
</form>
</center>
</div>
